<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>条件渲染指令</title>
</head>
<body>
<div id="app">
  <!-- v-if 为 false 直接销毁-->
  <div v-if="flag">404</div>

  <div v-if="type === 'A'">A</div>
  <div v-else-if="type === 'B'">B</div>
  <div v-else="type === 'C'">C</div>

  <template v-if="flag">
    <h2>Title</h2>
    <h4>Little Title</h4>
    <p>Content</p>
  </template>

  <!-- display: none-->
  <!-- 频繁切换使用 v-show, 反之用 v-if-->
  <div v-show="flag">显示/隐藏</div>
</div>

<script src="../vue.global.js"></script>
<script>
  const App = {
    data(){
      return {
        flag: false,
        type: "H",
      }
    }
  }

  const vm = Vue.createApp(App).mount('#app');
  console.log(vm)
</script>
</body>
</html>
